Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mamba/venom: increase kernel partition size #3852

Closed
wants to merge 3 commits into from
Closed

mamba/venom: increase kernel partition size #3852

wants to merge 3 commits into from

Conversation

SkewedZeppelin
Copy link
Contributor

@SkewedZeppelin SkewedZeppelin commented Feb 9, 2021

This merge request contains four commits:

  1. Increases mamba kernel partition from 3MB to 4MB
  2. Increases venom kernel partition from 3MB to 6MB.
    This is accomplished by shrinking their root partitions by 1MB and 3MB respectively.
  3. Re-enables these devices for buildbots
  4. Adds a compatibility version check and message

3MB is not enough for building with many kernel modules included and is not enough for Linux 5.10.
Both of their uboots from factory load up to those respective values.

I have tested mamba working with a 3.2MB 5.4 kernel.
I have tested mamba working with a 3.1MB 5.10 kernel.
@anomeome has tested mamba with a 3.2MB 5.10 kernel.
@solidus1983 has tested venom with a <3MB 5.4 kernel.

Compatibility can be checked like so:
mamba: fw_printenv | grep "pri_kern_size"; must equal 0x400000
venom: fw_printenv | grep "priKernSize"; must equal 0x0600000

Flashing process:
A factory style image is necessary when flashing to or away from a resized build

  • backup
  • flash a factory style image via sysupgrade, with force set and keep settings unset
  • restore backup
  • afterwards, you can flash normally.

Flashing from normal OpenWrt to resized has been tested to work.
Flashing from resized OpenWrt to normal has been tested to work.
Flashing from OEM firmware to resized has been tested to work (via user report).
Flashing from resized to OEM firmware has been tested to work (via user report).

There is more information in the forum thread post:
https://forum.openwrt.org/t/increasing-mamba-and-venom-kernel-partition-to-6mb/87807

@adschm adschm added the target/mvebu pull request/issue for mvebu target label Feb 9, 2021
@adschm
Copy link
Member

adschm commented Feb 9, 2021

Please update the Signed-off-by with your full real name.

@adschm
Copy link
Member

adschm commented Feb 9, 2021

Be aware that buildbot images will be bigger, so final numbers for kernel sizes should be acquired with buildbot settings and all feeds installed (unless you did that already, but number reported seem to low from my experience).

@SkewedZeppelin
Copy link
Contributor Author

SkewedZeppelin commented Feb 9, 2021 via email

@SkewedZeppelin
Copy link
Contributor Author

Building 5.4 with

CONFIG_ALL_KMODS=y
CONFIG_ALL_NONSHARED=y
CONFIG_STRIP_KERNEL_EXPORTS=n
CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE=y

yields a 3,203,306 byte kernel.

Tested booting on mamba.

Current OpenWrt snapshot for WRT3200ACM kernel size is 3,208,600.

@SkewedZeppelin
Copy link
Contributor Author

I pushed again and GitHub seems to have finally updated the PR.

Should I create a patch that undoes a1eb2c4 and ac9730c, or should I create a revert for each of them?

Should I also create a patch for a 1.2 compatibility version? Like 494f12c

@adschm
Copy link
Member

adschm commented Feb 9, 2021

Building 5.4 with

CONFIG_ALL_KMODS=y
CONFIG_ALL_NONSHARED=y
CONFIG_STRIP_KERNEL_EXPORTS=n
CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE=y

yields a 3,203,306 byte kernel.

Tested booting on mamba.

Current OpenWrt snapshot for WRT3200ACM kernel size is 3,208,600.

With all feeds installed?

./scripts/feeds update -a
./scripts/feeds install -a

@adschm
Copy link
Member

adschm commented Feb 9, 2021

Should I create a patch that undoes a1eb2c4 and ac9730c, or should I create a revert for each of them?

Just enable them in a patch, don't think you need to refer to the older ones for that.

Should I also create a patch for a 1.2 compatibility version? Like 494f12c

If sysupgrade still works, yes. If reflashing is required, the version should be bumped to 2.0.
In the latter case, you would not use board.d, but uci-defaults like in this case:
07aa858
(relevant changes are at the bottom)

@adschm
Copy link
Member

adschm commented Feb 9, 2021

And please do all the changes in one commit per device, i.e. adjust partitions, remove DEFAULT=n, adjust compat version.

@SkewedZeppelin
Copy link
Contributor Author

SkewedZeppelin commented Feb 9, 2021

Done.
It doesn't seem like compatibility messages stack? Might causes issues for those migrating from swconfig?

And yes that was with feeds installed.

@solidus1983
Copy link

So far no issues after flashing a resized image. Hopefully all goes well on the buildbots.

@anomeome
Copy link
Contributor

Tested the latest push:

  • option compat_version '2.0' to only the 2 targets of interest?
  • patch version number on mamba target, 3xx , 4xx?
  • backup restore of config deserves some elaboration, as you will get a message on the second flash due to the compat still being 1.1 post restore, until you do the second upgrade

@@ -112,6 +118,7 @@ TARGET_DEVICES += linksys_wrt1900acs
define Device/linksys_wrt1900ac-v1
$(call Device/linksys)
$(Device/dsa-migration)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dsa-migration can obviously be dropped now, as it's the same two variables you reset with the new include.

@adschm
Copy link
Member

adschm commented Feb 10, 2021

Please put the relevant changes directly in the first two patches; they belong together.

backup restore of config deserves some elaboration, as you will get a message on the second flash due to the compat still being 1.1 post restore, until you do the second upgrade

Well, essentially the compat_version is a property of the config; just consider swconfig vs. DSA. For backup/restore, you would have to change the uci config value manually similar to what uci-defaults does.

Still, in this very case we are left with the strange situation that /etc/board.json and /etc/config/system will have different explicit version numbers stored. I will have to think about that ...

@SkewedZeppelin
Copy link
Contributor Author

SkewedZeppelin commented Feb 10, 2021 via email

Copy link

@nitroshift nitroshift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run-tested on 2 WRT1900AC v1 (mamba). Confirmed as working.

nitroshift

@SkewedZeppelin
Copy link
Contributor Author

@adschm
Kindly, what changes do I need to make to see this merged?

@hauke
Copy link
Member

hauke commented Mar 19, 2021

Please use the same name as commit author and in the Signed-off-by line.
You can change it with git commit --author="" or fix it in your ~/.gitconfig

It is good that you do this in separate commits for venom and mamba.
Could you add the call to $(Device/kernel-size-migration) in the commit which changes the dts file. You can add the define Device/kernel-size-migration in the commit which changes the dts file for the first device.

mamba has a 3MB kernel partition as specified by the DTS.
3MB is not sufficient for building with many kernel modules or newer
kernel versions.

mamba uboot however as set from factory will load up to 4MB.
This can be observed by looking a uboot log:
	NAND read: device 0 offset 0xa00000, size 0x400000
	4194304 bytes read: OK
and from uboot environment variables:
	$ fw_printenv | grep "pri_kern_size";
	pri_kern_size=0x400000

Resize the root partitions from 37MB to 36MB to let kernel expand
into it another 1MB.
And set kernel target size to 4MB.

Lastly add a compatibility version message: kernel-size-migration.
And set it on mamba to prevent sysupgrading without first reinstalling from
a factory image.

Signed-off-by: Tad Davanzo <tad@spotco.us>
venom has a 3MB kernel partition as specified by the DTS.
3MB is not sufficient for building with many kernel modules or newer
kernel versions.

venom uboot however as set from factory will load up to 6MB.
This can be observed by looking a uboot log:
	NAND read: device 0 offset 0x900000, size 0x600000
	6291456 bytes read: OK
and from uboot environment variables:
	$ fw_printenv | grep "priKernSize";
	priKernSize=0x0600000

Resize the root partitions from 120MB to 117MB to let kernel expand
into it another 3MB.
And set kernel target size to 6MB.

Lastly set the kernel-size-migration compatibility version on venom to
prevent sysupgrading without first reinstalling from a factory image.

Signed-off-by: Tad Davanzo <tad@spotco.us>
Kernel size limits have been dealt with.
Effective revert of a1eb2c4 and ac9730c.

Signed-off-by: Tad Davanzo <tad@spotco.us>
@SkewedZeppelin
Copy link
Contributor Author

SkewedZeppelin commented Mar 19, 2021 via email

@hauke
Copy link
Member

hauke commented Mar 19, 2021

Thank you for the pull request, I pushed it to master.

@hauke hauke closed this Mar 19, 2021
@dominick-han
Copy link

Thanks everyone for making this patch! Finally can run clean no-patch truck builds on my mamba :)

@SkewedZeppelin SkewedZeppelin deleted the mamba-increase_kernel_size branch March 19, 2021 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target/mvebu pull request/issue for mvebu target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants